*//////////////////////////////////////////////////////////////////////////////
*                                                                             /         
*				High-Pressure, High-Paying Jobs?                              /
*               The Review of Economics and Statistics                        /
*                                                                             /
*               Authors: Markus Nagler, Johannes Rincke, Erwin Winkler        /
*                                                                             /
*               Do-File 2: Preparation of observational data (2018 wave)      /
*                                                                             /
*                                                                             /
*                                                                             /
*//////////////////////////////////////////////////////////////////////////////


********************************************************************************
****************************** BIBB 2018 ***************************************
********************************************************************************

use "$orig\ZA7574_v1-0-0.dta", replace

********************************************************************************
* Translate labels to English                                                  *
********************************************************************************
do "$do\2b_obs_translation_ETB2018_valuelabels_EN.do"
do "$do\2c_obs_translation_ETB2018_variablelabels_EN.do"

gen year=2018

********************************************************************************
* Generate variables                                                           *
********************************************************************************

rename S1 sex 

gen female=0
	replace female=1 if sex==2

rename zpalter age

rename max1202 educ 

gen high_edu=0
	replace high_edu=1 if educ==4 

gen med_edu=0
	replace med_edu=1 if inlist(educ,2,3) 

gen low_edu=0
	replace low_edu=1 if high_edu==0 & med_edu==0 

drop educ

rename Bula state 

rename BIK10 BIK 


gen german=0
	replace german=1 if F1607_01==1
	drop F1607_01
	
rename gew2018 weight



rename F233 state_work 

rename F233_nuts2 nuts2_work 

rename az hours 

rename F518_SUF income 

rename Stib position

rename F100_kldb2010_2d occ 

rename F100_kldb2010_3d occ_3d

rename F100_blossfeld occ_blo 

rename F100_isco08_2d occ_isco 

rename F100_isco08_3d occ_isco_3d 

rename Sector08 ind 

rename F515 firmsize
	replace firmsize=. if firmsize==99

gen firmsize1=0
	replace firmsize1=1 if inlist(firmsize,1,2,3) 
	replace firmsize1=. if firmsize==.

gen firmsize2=0
	replace firmsize2=1 if inlist(firmsize,4,5,6) 
	replace firmsize2=. if firmsize==.
	
gen firmsize3=0
	replace firmsize3=1 if inlist(firmsize,7) 
	replace firmsize3=. if firmsize==.

gen firmsize4=0
	replace firmsize4=1 if inlist(firmsize,8,9) 
	replace firmsize4=. if firmsize==.

gen firmsize5=0
	replace firmsize5=1 if inlist(firmsize,10,11)
	replace firmsize5=. if firmsize==.
	
gen works_council=0
	replace works_council=1 if F515_01==1
	replace works_council=. if F515_01==9
	drop F515_01
	
gen temp_contract=0
	replace temp_contract=1 if F507==1 
	replace temp_contract=. if F507==9
	drop F507
	
gen temp_agency=0
	replace temp_agency=1 if F509==1 
	replace temp_agency=. if F509==9
	drop F509
	
rename F1108 grade

rename F1224 grade_last



rename F411_01 deadlines 

gen d_deadlines=0
	replace d_deadlines=1 if inlist(deadlines,1)
	replace d_deadlines=. if deadlines==9
	
gen deadlines_b=0
	replace deadlines_b=1 if F412_01==1 
	replace deadlines_b=. if F412_01==9
	drop F412_01
	


rename F411_06 interrupt 
	
gen d_interrupt=0
	replace d_interrupt=1 if inlist(interrupt,1)
	replace d_interrupt=. if interrupt==9	
	

gen interrupt_b=0
	replace interrupt_b=1 if F412_06==1 
	replace interrupt_b=. if F412_06==9
	drop F412_06
	


rename F411_07 minimum 		
	
gen d_minimum=0
	replace d_minimum=1 if inlist(minimum,1)
	replace d_minimum=. if minimum==9	
	
gen minimum_b=0
	replace minimum_b=1 if F412_07==1
	replace minimum_b=. if F412_07==9
	drop F412_07
	
		
rename F411_09 multitasking 

gen d_multitasking=0
	replace d_multitasking=1 if inlist(multitasking,1)
	replace d_multitasking=. if multitasking==9

gen multitasking_b=0
	replace multitasking_b=1 if F412_09==1 
	replace multitasking_b=. if F412_09==9
	drop F412_09



rename F411_13 fast 

gen d_fast=0
	replace d_fast=1 if inlist(fast,1)
	replace d_fast=. if fast==9

gen fast_b=0
	replace fast_b=1 if F412_13==1 
	replace fast_b=. if F412_13==9	
	drop F412_13
	

	
	
gen computer=0
	replace computer=1 if F318==1 
	drop F318
	
rename F411_02 codifiable 

gen d_codifiable=0
	replace d_codifiable=1 if inlist(codifiable,1)
	replace d_codifiable=. if codifiable==9

rename F411_03 routine 

gen d_routine=0
	replace d_routine=1 if inlist(routine,1)
	replace d_routine=. if routine==9

rename F411_04 think 

gen d_think=0
	replace d_think=1 if inlist(think,1)
	replace d_think=. if think==9

rename F411_05 improve 

gen d_improve=0
	replace d_improve=1 if inlist(improve,1)
	replace d_improve=. if improve==9

rename F411_08 notlearned

gen d_notlearned=0
	replace d_notlearned=1 if inlist(notlearned,1)
	replace d_notlearned=. if notlearned==9
	
	
gen produce=0
	replace produce=1 if inlist(F303,1,2)
	replace produce=. if F303==9
	drop F303

gen measure=0
	replace measure=1 if inlist(F304,1,2)
	replace measure=. if F304==9
	drop F304
	
gen monitor=0
	replace monitor=1 if inlist(F305,1,2)
	replace monitor=. if F305==9
	drop F305
	
gen repair=0
	replace repair=1 if inlist(F306,1,2)
	replace repair=. if F306==9
	drop F306
	
gen transport=0
	replace transport=1 if inlist(F308,1,2)
	replace transport=. if F308==9	
	drop F308
	
gen feed=0
	replace feed=1 if inlist(F315,1,2)
	replace feed=. if F315==9
	drop F315
	
gen care=0
	replace care=1 if inlist(F316,1,2)
	replace care=. if F316==9
	drop F316
	
gen protect=0
	replace protect=1 if inlist(F317,1,2)
	replace protect=. if F317==9
	drop F317
	
gen clean=0
	replace clean=1 if inlist(F320,1,2)
	replace clean=. if F320==9
	drop F320
	
gen lift=0
		replace lift=1 if inlist(F600_03,1,2,3)
		replace lift=. if F600_03==9
	
gen dexterity=0
		replace dexterity=1 if inlist(F600_07a,1,2,3)
		replace dexterity=. if F600_07a==9
		drop F600_07a
	

gen shift=0
	replace shift=1 if F209_01==1 
	replace shift=. if F209_01==9
	drop F209_01

gen normal_workhours=0
	replace normal_workhours=1 if F209==1
	replace normal_workhours=. if F209==9
	drop F209
	
gen standby=0
	replace standby=1 if F216_01==1 
	drop F216_01

gen sat=0
	replace sat=1 if F220==1 
	replace sat=. if F220==9 
	drop F220

gen sun=0
	replace sun=1 if F223==1 
	replace sun=. if F223==9
	drop F223

gen home=0
	replace home=1 if F228==1 
	replace home=. if F228==9
	drop F228

gen sup=0
	replace sup=1 if F301==1 
	replace sup=. if F301==9
	drop F301
	
gen number_sub=F302  
    replace number_sub=0 if sup==0
	replace number_sub=. if number_sub==9999
	
rename F302_01 level 

gen upper_level=0
	replace upper_level=1 if level==1 
	replace upper_level=. if level==9
	
gen team_leader=0
	replace team_leader=1 if F503_01==1 
	replace team_leader=. if F503_01==9
	replace team_leader=. if F503_01==.
	drop F503_01
	
gen budget=0
	replace budget=1 if F503_02==1 
	replace budget=. if F503_02==9
	replace budget=. if F503_02==.
	drop F503_02

gen underqualified=0
		replace underqualified=1 if F410==2 
		replace underqualified=. if F410==9
		
gen overqualified=0
		replace overqualified=1 if F410==3 
		replace overqualified=. if F410==9


gen phys1=0
	replace phys1=1 if inlist(F600_03,1,2,3) 
	replace phys1=. if F600_03==9
	drop F600_03
	
gen phys2=0
	replace phys2=1 if inlist(F600_04,1,2,3) 
	replace phys2=. if F600_04==9
	drop F600_04
	
gen phys3=0
	replace phys3=1 if inlist(F600_05,1,2,3)
	replace phys3=. if F600_05==9
	drop F600_05

gen phys4=0
	replace phys4=1 if inlist(F600_06,1,2,3) 
	replace phys4=. if F600_06==9
	drop F600_06
	
gen phys5=0
	replace phys5=1 if inlist(F600_07b,1,2,3)==1 
	replace phys5=. if F600_07b==9	
	drop F600_07b
	
gen phys6=0
	replace phys6=1 if inlist(F600_09,1,2,3)==1 
	replace phys6=. if F600_09==9
	drop F600_09
	
gen phys7=0
	replace phys7=1 if inlist(F600_12,1,2,3)==1 
	replace phys7=. if F600_12==9	
	drop F600_12
	
gen phys8=0
	replace phys8=1 if inlist(F600_12a,1,2,3)==1 
	replace phys8=. if F600_12a==9
	drop F600_12a
	
gen autonomy1=0
	replace autonomy1=1 if F700_02==1 
	replace autonomy1=. if F700_02==9
	replace autonomy1=. if F700_02==.
	drop F700_02
	
gen autonomy2=0
	replace autonomy2=1 if F700_03==1 
	replace autonomy2=. if F700_03==9
	replace autonomy2=. if F700_03==.
	drop F700_03
	
gen autonomy3=0
	replace autonomy3=1 if F700_06==1 
	replace autonomy3=. if F700_06==9
	replace autonomy3=. if F700_06==.
	drop F700_06
	
gen important=0
	replace important=1 if F700_07==1 
	replace important=. if F700_07==9
	drop F700_07
	
gen teamfeeling=0
	replace teamfeeling=1 if F700_10==1 
	replace teamfeeling=. if F700_10==9 
	replace teamfeeling=. if F700_10==. 
	drop F700_10

	
gen new_prodtech=0
	replace new_prodtech=1 if F1001_01==1 
	replace new_prodtech=. if inlist(F1001_01,8,9)
	drop F1001_01
	
gen new_computer=0
	replace new_computer=1 if F1001_02==1 
	replace new_computer=. if inlist(F1001_02,8,9)
	drop F1001_02

gen reorga=0
	replace reorga=1 if F1001_06==1 
	replace reorga=. if inlist(F1001_06,8,9)
	drop F1001_06
	
gen shrink=0
	replace shrink=1 if F1001_07==1 
	replace shrink=. if inlist(F1001_07,8,9)
	drop F1001_07
	
gen dom_outs=0
	replace dom_outs=1 if F1001_08==1 
	replace dom_outs=. if inlist(F1001_08,8,9)
	drop F1001_08
	
gen outs=0
	replace outs=1 if F1002_01==1 
	replace outs=. if inlist(F1002_01,8,9)
	drop F1002_01
	
gen merge=0	
	replace merge=1 if F1002_02==1 
	replace merge=. if inlist(F1002_02,8,9)
	drop F1002_02
	
gen expansion=0
		replace expansion=1 if F1002_03==1 
		replace expansion=. if inlist(F1002_03,8,9)
		drop F1002_03
		
gen firm_performance= 0 
		replace firm_performance=1 if inlist(F516,1,2)
		replace firm_performance=. if inlist(F516,8,9,.)

	


rename F411_12 limit 

rename F1505 sickdays
replace sickdays=. if sickdays==999

gen d_limit=0
	replace d_limit=1 if inlist(limit,1)
	replace d_limit=. if limit==9

rename F411_14 relax

gen d_relax=0
	replace d_relax=1 if inlist(relax,1)
	replace d_relax=. if relax==9

rename F411_15 taxing 

gen d_taxing=0
	replace d_taxing=1 if inlist(taxing,1)
	replace d_taxing=. if taxing==9

gen toomuchwork=0
	replace toomuchwork=1 if F410==2 
	replace toomuchwork=. if F410==9
	drop F410
	
gen stress_increase=0
	replace stress_increase=1 if F1001_10==1
	replace stress_increase=. if F1001_10==9
	drop F1001_10
	
gen badhealth=0
	replace badhealth=1 if inlist(F1502,4,5) 
	replace badhealth=. if F1502==9
	replace badhealth=. if F1502==.
	drop F1502
	

	
gen nosleep=0
		replace nosleep=1 if F1500_14==1 
		replace nosleep=. if F1500_14==9
		drop F1500_14
	
gen tired=0
		replace tired=1 if F1500_15==1 
		replace tired=. if F1500_15==9
		drop F1500_15
		
gen nervous=0
	replace nervous=1 if F1500_18==1 
	replace nervous=. if F1500_18==9
	drop F1500_18
	
gen exhausted_phys=0
	replace exhausted_phys=1 if F1500_21==1 
	replace exhausted_phys=. if F1500_21==9
	drop F1500_21
	
gen exhausted_mental=0
		replace exhausted_mental=1 if F1500_22==1 
		replace exhausted_mental=. if F1500_22==9
		drop F1500_22
		

gen armpain=0
	replace armpain=1 if F1500_03a==1 
	replace armpain=. if F1500_03a==9
	drop F1500_03a
	
gen handpain=0
	replace handpain=1 if F1500_03b==1 
	replace handpain=. if F1500_03b==9 
	drop F1500_03b



gen jobchange=0
	replace jobchange=1 if inlist(F103,2) 
	replace jobchange=. if F103==9
	drop F103
	
gen job_unhappy=0
		replace job_unhappy=1 if inlist(F1451,3,4) 
		replace job_unhappy=. if F1451==9
		replace job_unhappy=. if F1451==.
		
gen job_happy=0
		replace job_happy=1 if inlist(F1451,1) 
		replace job_happy=. if F1451==9
		replace job_happy=. if F1451==.
		
drop F1451
		
gen worktime_unhappy=0
	replace worktime_unhappy=1 if inlist(F1450_03,3,4) 
	replace worktime_unhappy=. if F1450_03==9
	
gen worktime_happy=0
	replace worktime_happy=1 if inlist(F1450_03,1)
	replace worktime_happy=. if F1450_03==9	
	
	drop F1450_03

	
	
gen pay_unhappy=0
	replace pay_unhappy=1 if inlist(F1450_01,3,4) 
	replace pay_unhappy=. if F1450_01==9
	replace pay_unhappy=. if F1450_01==.
	
gen pay_happy=0
	replace pay_happy=1 if inlist(F1450_01,1) 
	replace pay_happy=. if F1450_01==9
	replace pay_happy=. if F1450_01==.
	
	
	drop F1450_01

gen boss_unhappy=0
	replace boss_unhappy=1 if inlist(F1450_05,3,4) 
	replace boss_unhappy=. if F1450_05==9
	replace boss_unhappy=. if F1450_05==.
	
gen boss_happy=0
	replace boss_happy=1 if inlist(F1450_05,1) 
	replace boss_happy=. if F1450_05==9
	replace boss_happy=. if F1450_05==.	
	
	drop F1450_05
	
	
gen promotion_unhappy=0
	replace promotion_unhappy=1 if inlist(F1450_02,3,4) 
	replace promotion_unhappy=. if F1450_02==9
	replace promotion_unhappy=. if F1450_02==9
	
gen promotion_happy=0
	replace promotion_happy=1 if inlist(F1450_02,1) 
	replace promotion_happy=. if F1450_02==9
	replace promotion_happy=. if F1450_02==9	
		
	drop F1450_02	
	
gen workplacemood_unhappy=0
	replace workplacemood_unhappy=1 if inlist(F1450_04,3,4) 
	replace workplacemood_unhappy=. if F1450_04==9
	replace workplacemood_unhappy=. if F1450_04==.
	

gen workplacemood_happy=0
	replace workplacemood_happy=1 if inlist(F1450_04,1) 
	replace workplacemood_happy=. if F1450_04==9
	replace workplacemood_happy=. if F1450_04==.
	drop F1450_04		
	
gen training_unhappy=0
	replace training_unhappy=1 if inlist(F1450_09,3,4) 
	replace training_unhappy=. if F1450_09==9
	replace training_unhappy=. if F1450_09==.
	
	
gen training_happy=0
	replace training_happy=1 if inlist(F1450_09,1) 
	replace training_happy=. if F1450_09==9
	replace training_happy=. if F1450_09==.
	drop F1450_09	
	
	
	
gen rare_praise=0
	replace rare_praise=1 if inlist(F700_14,3,4) 
	replace rare_praise=. if F700_14==8 
	replace rare_praise=. if F700_14==9
	replace rare_praise=. if F700_14==.
	drop F700_14
	
gen not_informed=0
	replace not_informed=1 if inlist(F700_08,1,2) 
	replace not_informed=. if F700_08==9
	replace not_informed=. if F700_08==.
	drop F700_08
	


gen married=0
	replace married=1 if F1600==1	
	
gen single_divorced=0
	replace single_divorced=1 if F1600==2 | F1600==3
	
gen divorced=0
	replace divorced=1 if F1600==3 
	
gen single=0
	replace single=1 if F1600==2 
	drop F1600
	
gen kid=0
	replace kid=1 if F1605==1 
	drop F1605

gen number_kids=0
	replace number_kids=1 if F1605a==1
	replace number_kids=2 if F1605a==2
	replace number_kids=3 if F1605a==3
	replace number_kids=4 if F1605a>3
	replace number_kids=. if F1605a==99
	drop F1605a

gen young_kid=0 
	replace young_kid=1 if inlist(F1605b,0,1,2,3,4,5,6)
	replace young_kid=1 if inlist(F1605c,0,1,2,3,4,5,6) 
	drop F1605b F1605c
	
gen partner_work=0
	replace partner_work=1 if F1603==1 
	replace partner_work=. if F1603==9
	replace partner_work=. if F1603==.	
	drop F1603
	
gen career=0
	replace career=1 if F900_01==1 
	replace career=. if F900_01==9
	drop F900_01
	
gen nofamily_time=0
	replace nofamily_time=1 if inlist(F208,3,4) 
	replace nofamily_time=. if F208==9
	drop F208
	
gen sacrifice_job=0
	replace sacrifice_job=1 if F1605f==1
	replace sacrifice_job=. if F1605f==9
	replace sacrifice_job=. if F1605e==9
	drop F1605f F1605e

rename F511_j tenure
replace tenure=. if tenure==9999
replace tenure=2018-tenure
	


		
	
keep year sex female age high_edu med_edu low_edu nuts2 state BIK german /*
*/ weight state_work nuts2_work hours income position occ occ_3d occ_blo /*
*/ ind firmsize1 firmsize2 firmsize3 firmsize4 firmsize5 works_council   /*
*/ temp_contract temp_agency d_deadlines deadlines_b d_interrupt interrupt_b /*
*/ d_minimum minimum_b d_multitasking multitasking_b d_fast fast_b deadlines multitasking interrupt minimum fast computer /*
*/ d_codifiable d_routine d_think d_improve d_notlearned shift standby /*
*/ sat sun home sup number_sub upper_level team_leader budget underqualified overqualified /*
*/ phys1 phys2 phys3 phys4 phys5 phys6 phys7 phys8 autonomy1 autonomy2 /*
*/ important new_prodtech new_computer reorga shrink dom_outs outs merge /*
*/ expansion d_limit limit d_relax d_taxing toomuchwork stress_increase worktime_unhappy /*
*/ nosleep tired nervous exhausted_phys exhausted_mental married kid number_kids /*
*/ young_kid partner_work career nofamily_time sacrifice_job training_unhappy /*
*/ workplacemood_unhappy promotion_unhappy boss_unhappy pay_unhappy job_unhappy /*
*/ jobchange handpain armpain autonomy3 grade grade_last produce measure repair monitor transport /*
*/ feed care protect clean lift dexterity 	rare_praise not_informed normal_workhours sickdays ///
single_divorced  divorced single firm_performance	occ_isco occ_isco_3d job_happy worktime_happy pay_happy boss_happy promotion_happy workplacemood_happy promotion_happy training_happy tenure firmsize

	
	
	
order year sex female age high_edu med_edu low_edu nuts2 state BIK german /*
*/ weight state_work nuts2_work hours income position occ occ_3d occ_blo /*
*/ ind firmsize1 firmsize2 firmsize3 firmsize4 firmsize5 works_council   /*
*/ temp_contract temp_agency d_deadlines deadlines_b d_interrupt interrupt_b /*
*/ d_minimum minimum_b d_multitasking multitasking_b d_fast fast_b computer /*
*/ d_codifiable d_routine d_think d_improve d_notlearned shift standby /*
*/ sat sun home sup number_sub upper_level team_leader budget underqualified overqualified /*
*/ phys1 phys2 phys3 phys4 phys5 phys6 phys7 phys8 autonomy1 autonomy2 /*
*/ important new_prodtech new_computer reorga shrink dom_outs outs merge /*
*/ expansion d_limit d_relax d_taxing toomuchwork stress_increase worktime_unhappy /*
*/ nosleep tired nervous exhausted_phys exhausted_mental married kid number_kids /*
*/ young_kid partner_work career nofamily_time sacrifice_job training_unhappy /*
*/ workplacemood_unhappy promotion_unhappy boss_unhappy pay_unhappy job_unhappy /*
*/ jobchange handpain armpain autonomy3 	rare_praise not_informed sickdays firm_performance single_divorced  divorced single	tenure

	
	
	
save "$data\bibb_2018_temp.dta", replace
	
	
	
	
	
	
********************************************************************************
* Data restrictions for main analysis (private sector workers)                 *
********************************************************************************	
	
keep if age>=20 & age<=60 
keep if inlist(position, 1,2,9) 
keep if hours>=35
drop if income==99999 | income==99998
drop if income<1000
drop if income>=50000
drop if inlist(occ,-34,-1,99,98,97) 
drop if inlist(ind,-1)
drop if inlist(nuts2_work,99996,99997,99998,99999)

drop if missing(income, hours, high_edu, med_edu, low_edu, age, female, german, /*
*/      nuts2, nuts2_work, BIK, grade, works_council, temp_agency, firmsize1, /*
*/      firmsize2, firmsize3, firmsize4, firmsize5, d_routine, d_codifiable, /*
*/      computer, temp_contract, phys1, phys2, phys3, phys4, phys5, phys6, phys7, /*
*/      phys8, d_deadlines, d_interrupt, d_fast, d_minimum, /*
*/      d_multitasking, normal_workhours, shift, standby, number_sub, phys1, phys2, phys3, phys4, phys5, phys6,phys7,phys8)

tab grade, gen(grade_)
drop grade

tab grade_last, gen(grade_last_)
drop grade_last


gen ln_income=100*(ln(income))
gen wage=income/(hours*4)
gen ln_wage=100*(ln(wage))
gen ln_hours=100*(ln(hours))
gen age2 = age^2
gen age3 = age^3

gen commute=0
	replace commute=1 if nuts2!=nuts2_work

tab occ, gen(d_occ2d_)
tab occ_3d, gen(d_occ3d_)
tab occ_isco, gen(d_occ_isco2_)
tab occ_isco_3d, gen(d_occ_isco3_)
tab ind, gen(d_ind_)
tab BIK, gen(d_bik_)

gen phys_index = (phys1+phys2+phys4+phys5+phys6+phys7+phys8)/8	
		
gen pressure= (d_deadlines + d_multitasking + d_interrupt + d_minimum)/4
gen pressure2= (d_deadlines + d_multitasking)/2
gen pressure3= (d_deadlines + d_multitasking + d_interrupt)/4
gen pressure_bother= (deadlines_b + multitasking_b + interrupt_b + minimum_b)/4
gen pressure5= (d_deadlines + d_multitasking + d_interrupt + d_minimum + d_fast)/5

corr pressure pressure2 pressure3 pressure5


label variable pressure "High pressure"
label variable age "Age"
label variable age2 "age^2"
label variable age3 "age^3"
label variable high_edu "University"
label variable med_edu "Vocational"
label variable low_edu "No degree"
label variable works_council "Works council"
label variable temp_agency "Temp. work agency"
label variable firmsize1 "<5 employees"
label variable firmsize2 "5-49 employees"
label variable firmsize3 "50-249 employees"
label variable firmsize4 "250-999 employees"
label variable firmsize5 "$\geq$ 1,000 employees"
label variable d_routine "Routine job"
label variable d_codifiable "Codifiable job"
label variable computer "Computer use"
label variable commute "Commuting"
label variable temp_contract "Temp. contract"
label variable phys_index "physical"
label var normal_workhours "Standard work hours"
label var shift "Shift work"
label var standby "Frequent stand-by for work"
label var number_sub "no. of subordinates"
label var female "Female"
label var german "German"
label var phys_index "Index of physically demanding work"
label var firmsize "Firm size"
	
save "$data\bibb_2018_processed.dta", replace





********************************************************************************
* Data restrictions for placebo (civil servants)                               *
********************************************************************************

use "$data\bibb_2018_temp.dta", replace

keep if age>=20 & age<=60 
keep if hours>=35 
keep if inlist(position,3) 
drop if income==99999 | income==99998
drop if income<1000
drop if income>=50000
drop if inlist(occ,-34,-1,99,98,97) 
drop if occ_blo==-4 | occ_blo==-1 
drop if inlist(ind,-1)
drop if inlist(nuts2_work,99996,99997,99998,99999)

drop if missing(income, hours, high_edu, med_edu, low_edu, age, female, german, /*
*/      nuts2, nuts2_work, BIK, grade, works_council, temp_agency, firmsize1, /*
*/      firmsize2, firmsize3, firmsize4, firmsize5, d_routine, d_codifiable, /*
*/      computer, temp_contract, phys1, phys2, phys3, phys4, phys5, phys6, phys7, /*
*/      phys8, d_deadlines, d_interrupt, d_fast, d_minimum, /*
*/      d_multitasking, normal_workhours, shift, standby, phys1, phys2, phys3, phys4, phys5, phys6,phys7,phys8)


gen ln_income=100*(ln(income))
gen wage=income/(hours*4)
gen ln_wage=100*(ln(wage))
gen ln_hours=100*(ln(hours))
gen age2 = age^2
gen age3 = age^3

gen commute=0
	replace commute=1 if nuts2!=nuts2_work

tab occ, gen(d_occ2d_)
tab ind, gen(d_ind_)
tab BIK, gen(d_bik_)

gen phys_index = (phys1+phys2+phys4+phys5+phys6+phys7+phys8)/8	

gen pressure= (d_deadlines + d_multitasking + d_interrupt + d_minimum)/4


label variable pressure "High pressure"


save "$data\bibb_2018_processed_placebo.dta", replace





erase "$data\bibb_2018_temp.dta"



	
	
	
	





